package com.gopay.common.cps.service.fund;

import com.gopay.common.domain.cps.CpsGenMainOrder;
import com.gopay.common.domain.cps.CpsGenPayOrder;
import com.gopay.common.domain.fund.FundGopayCpsGenOrder;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 基金获取订单服务
 * @author dong-wang5@hnair.com
 * @date 2017-12-28 20:59:16
 */
public interface FundOrderService {

    FundGopayCpsGenOrder getFundOrderByGopayOrderId(String gopayOrderId);

    /**
     * 根据订单号获取主订单
     * @author yhwpeng@126.com
     * @date 2017-12-28 20:58:27
     * @params
     * @param gopayOrderId :
     * @return com.gopay.common.domain.cps.CpsGenMainOrder
     */
    CpsGenMainOrder getCpsGenMainOrderByGopayOrderId(String gopayOrderId);

    /**
     * 获取如下交易码的进行中订单：'02012','02014','02015','02020','02021'
     * @author yhwpeng@126.com
     * @date 2018-01-03 17:12:44
     * @params
     * @param gopayOrderId :
     * @return java.util.List<com.gopay.common.domain.cps.CpsGenMainOrder>
     */
    List<CpsGenMainOrder> getCpsGenMainOrder4Settle(String gopayOrderId);

    /**
     * 获取单个交易码的数据
     * @author yhwpeng@126.com
     * @date 2018-01-03 17:12:44
     * @params
     * @param gopayOrderId :
     * @param intTxnCd :
     * @return java.util.List<com.gopay.common.domain.cps.CpsGenMainOrder>
     */
    List<CpsGenMainOrder> getCpsGenMainOrder4Settle(String gopayOrderId, String intTxnCd);

    CpsGenPayOrder getCpsGenPayOrderByGopayOrderId(String gopayOrderId);

    void updateFundCpsOrderTypeByGopayOrderId(String gopayId, String orderType);

    void updatePayOrders(CpsGenPayOrder pay);

    void updateMainOrder(CpsGenMainOrder mainOrder);

    void updateFundOrder(FundGopayCpsGenOrder fundOrder);

    /**
     * 同步更新基金与国付宝订单状态
     * @author yhwpeng@126.com
     * @date 2018-01-16 16:09:57
     * @params
     * @param gopayOrderId :
     * @param fundOrderType :
     * @param txnStaCd :
     * @return void
     */
    @Transactional(propagation = Propagation.REQUIRED,rollbackFor=Exception.class)
    void updateFundAndMainOrderByGopayOrderId(String gopayOrderId, String fundOrderType, int txnStaCd);
}
